package model

import (
	"gorm.io/gorm"
	"time"
)

type Order struct {
	Id        uint           `gorm:"column:id;type:bigint(20) UNSIGNED;primaryKey;not null;" json:"id"`
	UserId    uint           `gorm:"column:user_id;type:bigint(20) UNSIGNED;comment:用户id;not null;default:0;" json:"user_id"`                           // 用户id
	HouseId   uint           `gorm:"column:house_id;type:bigint(20) UNSIGNED;comment:房源id;not null;default:0;" json:"house_id"`                         // 房源id
	Price     uint           `gorm:"column:price;type:bigint(20) UNSIGNED;comment:价格;not null;default:0;" json:"price"`                                 // 价格
	PayUrl    string         `gorm:"column:pay_url;type:varchar(255);comment:上传首付凭证;not null;" json:"pay_url"`                                          // 上传首付凭证
	Status    uint           `gorm:"column:status;type:bigint(20) UNSIGNED;comment:状态 1待上传首付凭证 2带审核 3签约 4尾款 5过户 6完成;not null;default:1;" json:"status"` // 状态 1待上传首付凭证 2带审核 3签约 4尾款 5过户 6完成
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" json:"deleted_at"`
}

func (o *Order) TableName() string {
	return "order"
}
